﻿#include "binarytree.h"
#include "Queue.h"

int main()
{
	//这里还没写初始化，所有直接malloc一个
	BTNode* A = (BTNode*)malloc(sizeof(BTNode));
	A->data = 'A';
	A->left = NULL;
	A->right = NULL;

	BTNode* B = (BTNode*)malloc(sizeof(BTNode));
	B->data = 'B';
	B->left = NULL;
	B->right = NULL;

	BTNode* C = (BTNode*)malloc(sizeof(BTNode));
	C->data = 'C';
	C->left = NULL;
	C->right = NULL;

	BTNode* D = (BTNode*)malloc(sizeof(BTNode));
	D->data = 'D';
	D->left = NULL;
	D->right = NULL;

	BTNode* E = (BTNode*)malloc(sizeof(BTNode));
	E->data = 'E';
	E->left = NULL;
	E->right = NULL;

	BTNode* F = (BTNode*)malloc(sizeof(BTNode));
	F->data = 'F';
	F->left = NULL;
	F->right = NULL;

	BTNode* G = (BTNode*)malloc(sizeof(BTNode));
	G->data = 'G';
	G->left = NULL;
	G->right = NULL;

	BTNode* H = (BTNode*)malloc(sizeof(BTNode));
	H->data = 'H';
	H->left = NULL;
	H->right = NULL;

	BTNode* I = (BTNode*)malloc(sizeof(BTNode));
	I->data = 'I';
	I->left = NULL;
	I->right = NULL;

	A->left = B;
	A->right = C;
	B->left = D;
	B->right = E;
	D->left = F;
	D->right = G;
	G->left = H;
	G->right = I;

	PrevOrder(A);
	printf("\n");

	InOrder(A);
	printf("\n");

	PostOrder(A);
	printf("\n");

	//求树节点的个数，方法1
	/*int size = 0;
	TreeSize1(A, &size);
	printf("%d\n", size);*/

	//求树节点的个数，方法2
	int size = TreeSize2(A);
	printf("%d\n", size);

	int leafsize = TreeLeafSize(A);
	printf("%d\n", leafsize);

	LevelOrder(A);
	return 0;
}